package ai.plantdata.Structural.mode.FilterPattern.interfaces.impl;

import ai.plantdata.Structural.mode.FilterPattern.classes.Person;
import ai.plantdata.Structural.mode.FilterPattern.interfaces.Criteria;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: WangHui
 * @Date: 2020/12/19 14:48
 * @Description:
 */
public class CriteriaSingle implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> singlePersons = new ArrayList<Person>();
        for (Person person : persons) {
            if("SINGLE".equalsIgnoreCase(person.getMaritalStatus())){
                singlePersons.add(person);
            }
        }
        return singlePersons;
    }
}
